<?php

class Questionnaire extends CActiveRecord
{
	/**
	 * The followings are the available columns in table 'tbl_comment':
	 * @var integer $id
	 * @var string $content
	 * @var integer $status
	 * @var integer $created
	 * @var string $author
	 * @var string $email
	 * @var string $url
	 * @var integer $post_id
	 */
	const STATUS_PENDING=1;
	const STATUS_APPROVED=2;
        public $id;
        public $name;

	/**
	 * Returns the static model of the specified AR class.
	 * @return CActiveRecord the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{questionnaire}}';
	}

	/**
	 * @return array validation rules for model attributes.

	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			//array('content, author, email', 'required'),
			//array('author, email, url', 'length', 'max'=>128),
			//array('email','email'),
			//array('url','url'),
		);
	}
	 */
	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
                    'examCount'=>array(
                            self::STAT, 'Exam', 'questionnaire'
                    ),
                   'questionCount'=>array(
                            self::STAT, 'Question', 'questionnaire'
                    ),
                    'testCount'=>array(
                            self::STAT, 'QuestionnaireTyp', 'questionnaire'
                    ),
                    'types' => array(self::HAS_MANY, 'QuestionnaireTyp', 'questionnaire'
                    ),

		);
	}
}
